﻿Imports System.Windows.Forms

Namespace Common

    Public Class MessageBase

        Public Shared Function ShowMessage(ByVal content As String, _
                                           Optional ByVal defaultButtons As MessageBoxButtons = MessageBoxButtons.OK) As DialogResult

            Dim ApplicationTitle As String = ""
            If My.Application.Info.Title <> "" Then
                ApplicationTitle = My.Application.Info.Title
            Else
                ApplicationTitle = System.IO.Path.GetFileNameWithoutExtension(My.Application.Info.AssemblyName)
            End If

            Return MessageBox.Show(content, ApplicationTitle, defaultButtons)

        End Function

        Public Shared Function ShowMessage(ByVal hwnd As IWin32Window, _
                                           ByVal content As String, _
                                           Optional ByVal defaultButtons As MessageBoxButtons = MessageBoxButtons.OK) As DialogResult

            Dim ApplicationTitle As String = ""
            If My.Application.Info.Title <> "" Then
                ApplicationTitle = My.Application.Info.Title
            Else
                ApplicationTitle = System.IO.Path.GetFileNameWithoutExtension(My.Application.Info.AssemblyName)
            End If

            Return MessageBox.Show(hwnd, content, ApplicationTitle, defaultButtons)

        End Function

        Public Shared Function ShowMessage(ByVal content As String, _
                                           ByVal caption As String, _
                                           Optional ByVal defaultButtons As MessageBoxButtons = MessageBoxButtons.OK) As DialogResult

            Return MessageBox.Show(content, caption, defaultButtons)

        End Function

        Public Shared Function ShowMessage(ByVal hwnd As IWin32Window, _
                                           ByVal content As String, _
                                           ByVal caption As String, _
                                          Optional ByVal defaultButtons As MessageBoxButtons = MessageBoxButtons.OK) As DialogResult

            Return MessageBox.Show(hwnd, content, caption, defaultButtons)

        End Function

    End Class

End Namespace
